import type { IOptions } from '@/types/animateNumber'
import { gsap } from 'gsap'
export const useAnimateNumber = (options: IOptions) => {
  options = Object.assign(
    {
      start: 0,
      step: 0.01,
      duration: 1.5
    },
    options
  )
  gsap.fromTo(
    options.el,
    {
      innerText: options.start
    },
    {
      innerText: options.end,
      snap: {
        innerText: options.step as number
      },
      duration: options.duration,
      ease: 'power1.out'
    }
  )
}